"""打包部署工具"""

import PyInstaller.__main__
import os
import sys
from pathlib import Path


def build_package():
    """构建可执行包"""
    pyinstaller_args = [
        'src/main.py',
        '--name=VideoTranscoder',
        '--onefile',
        '--windowed',
        '--icon=assets/icon.ico',
        '--add-data=src;src',
        '--add-data=config;config',
        '--hidden-import=PyQt6.QtCore',
        '--hidden-import=PyQt6.QtGui',
        '--hidden-import=PyQt6.QtWidgets',
        '--hidden-import=PyQt6.QtCharts',
        '--collect-all=PyQt6',
        '--collect-all=psutil',
        '--collect-all=py-cpuinfo',
    ]
    
    # Platform specific configuration
    if os.name == 'nt':  # Windows
        pyinstaller_args.extend([
            '--add-binary=C:\\Python\\Lib\\site-packages\\PyQt6\\Qt6\\plugins\\platforms\\qwindows.dll;PyQt6/Qt6/plugins/platforms/'
        ])
    
    PyInstaller.__main__.run(pyinstaller_args)


def create_installer():
    """创建安装程序"""
    # 这里可以集成NSIS或Inno Setup来创建安装程序
    pass


def create_portable_package():
    """创建便携版包"""
    # 创建包含所有依赖的便携版
    pass


if __name__ == '__main__':
    build_package()